package com.lab.spring.topic2;

import com.lab.spring.topic2.messaging.Cashier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA.
 * User: bsceran
 * Date: 5/22/13
 * Time: 9:19 AM
 * To change this template use File | Settings | File Templates.
 */
public class Invoker2 {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("springContext2.xml");
//        Product battery = (Product) applicationContext.getBean("aaa");
//        Product disc = (Product) applicationContext.getBean("cdrw");
//        Product battery = (Product) applicationContext.getBean("aaa2");
//        Product disc = (Product) applicationContext.getBean("cdrw2");

//        Product battery = (Product) applicationContext.getBean("aaa5");
//        battery.setName("BBB");
//        Product battery2 = (Product) applicationContext.getBean("aaa5");
//        Product disc = (Product) applicationContext.getBean("cdrw4");
//
//
//        System.out.println("Battery : " + battery);
//        System.out.println("Battery : " + battery2);
//        System.out.println("Disc    : " + disc);

        System.out.println("Checking out 1000.0");
        Cashier cashier = (Cashier) applicationContext.getBean("cashier");
        cashier.checkout(1000.0);
        System.out.println("Check out finished.");
    }
}
